

function back() {
    history.go(-1);
}
function submit() {
    $.ajax({
        url:url,
        type:"post",
        dataType:"text",
        data:$("#forms").serialize(),
        success:function (data) {
//             alert(data)                                     //测试data
            if(data=="1"){                                 //判断是否成功
                alert("修改成功");
                location.href=locationurl;
            }else{
                alert("修改失败")
            }
        },
        error:function (e) {
            alert(e.response)
        }
    });
}
$.validator.setDefaults({
    submitHandler: function() {

        submit();
    }
});
$(function () {
    $("#forms").validate({
        rules: {
            record_name: {
                required: true,
                maxlength: 16
            },
            category: {
                required: true
            },
            introduce: {
                required: true,
                maxlength: 30
            },
            difficulty: {
                required: true
            },
            charge: {
                required: true
            }
        },
        messages: {
            record_name: {
                required: "请输入用户名"
            }
        }
    });


})